<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/kendocommon.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title>评论查看</title>
    <meta charset="utf-8">
    <style>
    	table{font-size:12px}
    </style>
    <script>
        $(document).ready(function() {
        	
        	$("#toolbar").kendoToolBar({
	            resizable: false,
	            items: [
	            	{ type: "separator" },
	                { template: "<label>时间:</label><input name='date_from' id='date_from'>" },
	                { template: "<label>-</label><input name='date_to' id='date_to'>" },
	                { type: "separator" },
	                { type: "button", text: "查询",click: queryInfo }
	            ]
	        });
	        //&toUserID=WV00000033
            dataSource = new kendo.data.DataSource({
                transport: {
                    read:  {
                        url: "${path}/assist/queryCommentList?fromUserID=${c_user_id}&serviceModuleCode=3",
                        dataType: "json",
                        data: function() {
					        return {
					         	date_from:$('#date_from').val(),
					         	date_to:$('#date_to').val()
					        };
					    }
                    }
                },
                //group: [{field: "deptName"}],
                serverPaging: true,
                serverFiltering: true,
                pageSize: 10,
                schema: {
                	data:"data",
               		total:"total"
                }
            });
            
            $("#grid").kendoGrid({
                dataSource: dataSource,
                pageable: {
					refresh: true,
					pageSizes: true,
					buttonCount: 5,
					page: 1,
					pageSize: 10,
					pageSizes: [10, 20, 30],
					messages: {
						display: "显示 {0}-{1} 共 {2} 项",
						empty: "没有数据",
						itemsPerPage: "每面显示数量",
						first: "第一页",
						last: "最后一页",
						next: "下一页",
						previous: "上一页"
					}
				},
                selectable: "multiple row",
                allowCopy: true,
                groupable: {
                    messages: {
                      empty: "将列拖拽到此处进行分类查看"
                    }
                },
                editable: "popup",
                columns: [
                	//{ field:"id", template: "<input type='checkbox' id='#:id#' />",width: "120px",headerTemplate: '<input type="checkbox" id="check-all" />'},
                    { field:"fromUserName", title: "评论人姓名",width: "120px"},
                    { field:"fromUserType", title: "评论人身份",width: "120px"},
                    
                    { field:"toUserName", title: "被评论人姓名",width: "120px"},
                    { field:"toUserType", title: "被评论人身份",width: "120px"},
                    
                    { field:"createdTime", title: "评论时间",width: "150px"},
                    { field:"comment", title: "评论",width: "150px"},
                 //   { field:"course_name", title: "课程名",width: "150px"},
                 //   { field:"course_start_time", title: "课程开始时间",width: "150px"}
                      //{ field: "UnitsInStock", title:"Units In Stock", width:"120px"},//,format:"{0:yyyy/MM/dd}"
                    //{ command: [{name:"editrow",text:"<span class='k-icon k-edit'></span>查看",click:queryCustomerInfo,buttonType:"ImageAndText"}], title: "操作", width: "100px" }
                    ]
            });
            //<span class='k-icon k-i-group'>  ,buttonType:"ImageAndText"
            //$('#grid').css("height",document.body.clientHeight-40);
            
            $("#date_from").kendoDatePicker({format: "yyyy-MM-dd"});
            $("#date_to").kendoDatePicker({format: "yyyy-MM-dd"});
            
            $(".fancybox").fancybox({
				openEffect	: 'none',
				closeEffect	: 'none'
			});
		});
		
        
   
		//查询
		var queryInfo = function(e){
			//$("#grid").data("kendoGrid").dataSource.read({date_from:$('#date_from').val(),date_to:$('#date_to').val()});
			$("#grid").data("kendoGrid").dataSource.fetch();
			$("#grid").data("kendoGrid").dataSource.page(1);
		}
		
		//单元格照片处理
		var videoFun = function(dataItem){
			var str = "<a href='${path}/assist/pubsrc?pubsrc="+dataItem.url+"' class='fancybox fancybox.iframe' id='commontlist' title='视频播放' >";
				str +="<img src='"+dataItem.image_url+"@200w"+"' alt='' />";
				str +="</a>";
			return str;
		}
		
		
		var setFormData = function(data){
			$('#baby_name').val(data.baby_name);
		}
		
    </script>
</head>
<body>
	<div id="toolbar" style="margin:2px"></div>
    <div id="grid" style="margin:2px;font-size:10px"></div>
</body>
</html>
